package br.com.siscov.control.form;

import java.util.List;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMessage;
import org.apache.struts.action.ActionMessages;

public abstract class BaseForm extends ActionForm {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	protected String acao;

	public String getAcao() {
		return acao;
	}

	public void setAcao(String acao) {
		this.acao = acao;
	}

	protected boolean validarObrigatorio(ActionErrors erros, List<String> valores) {

		boolean valida = true;

		for (String valor : valores) {
			if (valor == null || "".equals(valor.trim())) {
				valida = false;
			}
		}
		if (!valida) {
			erros.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("msg.erro.campos.obrigatorios"));
		}
		return valida;
	}

}
